package cn.javasm.service.impl;

import cn.javasm.dao.UserDao;
import cn.javasm.demo.TestDemo;
import cn.javasm.entity.User;
import cn.javasm.enums.PrivEnum;
import cn.javasm.privanno.PrivAnno;
import cn.javasm.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @version: 0.1
 */
@Service
public class UserServiceImpl implements UserService {
    @Autowired
    private UserDao userDao;
    @Override
    public void registUser(User user) {
        userDao.registUser(user);
    }

    @Override
    @PrivAnno({PrivEnum.USER,PrivEnum.ADMIN})
    public void updateUser(User user) {
        userDao.updateUser(user);
    }

    @Override
    @PrivAnno(PrivEnum.ADMIN)
    public void deleteUserById(int id) {
        userDao.deleteUserById(id);
    }

    @Override
    @PrivAnno({PrivEnum.USER,PrivEnum.ADMIN})
    public User queryUserById(int id) {
        return userDao.queryUserById(id);
    }

}
